package org.uu.controller;

import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.uu.service.HelloService;

@RestController
public class HelloController {

    @DubboReference(version = "0.0.1")
    private HelloService helloService;

    @DubboReference(version = "0.0.2", retries = 4)
    private HelloService hiService;

    @GetMapping("/hello/{name}")
    public String hello(@PathVariable("name") String name) {
        String hello = helloService.sayHello(name);
        System.out.println(helloService.sayHello(name));
        return hello;
    }

    @GetMapping("/hi/{name}")
    public String hi(@PathVariable("name") String name) {
        String hello = hiService.sayHello(name);
        System.out.println(hiService.sayHello(name));
        return hello;
    }
}
